﻿using System;
using System.Data;
using System.Data.SqlClient;

namespace LimpaGaragem.Framework
{
    public class Connection
    {
        #region VARIABLES

            public SqlConnection connection;

        #endregion

        #region METHODS
            
            /// <summary>
            /// Open connection with SqlConnection
            /// </summary>
            /// <param name="strConexao"></param>
            public void Connect(string strConexao)
            {
                connection = new SqlConnection(strConexao);
                connection.Open();
            }

            /// <summary>
            /// Close connection with SqlConnection
            /// </summary>
            public void Disconnect()
            {
                if (connection != null)
                {
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                }
            }

        #endregion
    }
}
